import static org.junit.Assert.assertTrue;

import java.io.File;

import model.cnf.FileCNF;
import model.cnf.MemoryCNF;
import model.cnf.Stat;

import org.junit.Test;

public class TestStat {
	
	@Test
	public void testStatMemoryCNF(){
		File directoryTstCNF = new File("tstcnf");
		File cnf = new File(directoryTstCNF, "cour.cnf");

		//met en place le temoin
		Stat temoin = new Stat();
		temoin.setNumBinaryClause(403);
		temoin.setNumClause(409);
		temoin.setNumLiteral(872);
		temoin.setNumUnitClause(0);
		temoin.setNumVar(286);
		
		MemoryCNF mem = null;
		try {
			mem = new MemoryCNF(cnf.getAbsolutePath());
			mem.checkStat();
		} catch (Exception e) {
			e.printStackTrace();
		} 
		
		
		assertTrue("stat for memoryCNF doesn't work", temoin.equals(mem.getStat()));
	}

	@Test
	public void testStatFileCNF(){
		File directoryTstCNF = new File("tstcnf");
		File cnf = new File(directoryTstCNF, "cour.cnf");

		//met en place le temoin
		Stat temoin = new Stat();
		temoin.setNumBinaryClause(403);
		temoin.setNumClause(409);
		temoin.setNumLiteral(872);
		temoin.setNumUnitClause(0);
		temoin.setNumVar(286);
		
		FileCNF file = null;
		
		try {
			file = new FileCNF(cnf.getAbsolutePath());
			file.checkStat();
		} catch (Exception e) {
			e.printStackTrace();
		} 
		
		assertTrue("stat for FileCNF doesn't work", temoin.equals(file.getStat()));
				
	}

	
}
